In [1]:
import numpy as np
import pandas as pd
import math
import cmath
from scipy.optimize import root
from scipy.integrate import odeint
from __future__ import division
from scipy import *
from pylab import *
import matplotlib.pyplot as plt
%matplotlib inline
In [47]:
xo = 0.5
xk = 0.3
gamma = 0.8
A = 2
yr = 0.1 #kg kgCO2 −1
#tao = np.linspace(0,5)
#print(tao)
#print(np.shape(tao), type(tao))
In [4]:
tao1 = (xo - xk) / (gamma * A * yr)
tao1
Out[4]:
In [5]:
tao2 = tao1 + xk / (gamma * A * yr) * np.log(xk / xo + (1 - xk / xo) * np.exp(xo / xk * A))
tao2
Out[5]:
In [6]:
def concentracion(tao):
if tao == 1:
x = x0 - gamma * A * yr * tao * exp(-A*z)
return x
if tao == 2:
x = x0 - (xo - xk) * exp(-A * (z - zk))
return x
if tao == 3:
x = x0 / (1 + ((xo/xk) * exp(gamma * A * yr / xk * (tao - tao1)) - 1) * exp(-xo/xk * A*z))
return x
In [7]:
zk = xk / (A * xo) * np.log((xo * np.exp(gamma * A * yr / xk * (tao - tao1)) - xk) / (xo - xk))
zk
In [8]:
tao2 = tao1 + xk / (gamma * A * yr) * np.log(xk / xo + (1 - xk / xo) * np.exp(xo / xk * A))
tao2
Out[8]:
In [9]:
e = gamma * yr* tao * (1- np.exp(-A))
np.shape(e)
type(e)
In [14]:
plt.plot(tao, e)
Out[14]:
In [15]:
e = gamma * yr* (tao - tao1 * np.exp(-A * (1 - zk)))
In [17]:
e = xo - xk / A * np.log(1 + xk / xo * (np.exp(xo / xk * A) - 1)) * np.exp(gamma * A * yr / xk * (tao1 - tao))
In [48]:
def rendimiento(tao):
if tao <= tao1 and tao < tao2:
e = gamma * yr* tao * (1- np.exp(- A))
print("tao < tao1 and tao < tao2")
return e
if tao > tao1 and tao <= tao2:
zk = xk / (A * xo) * np.log((xo * np.exp(gamma * A * yr / xk * (tao - tao1)) - xk) / (xo - xk))
e = gamma * yr * (tao - tao1 * np.exp(- A * (1 - zk)))
print("tao >= tao1 and tao < tao2")
return e
if tao > tao2:
e = xo - xk / A * np.log(1 + xk / xo * (np.exp(xo / xk * A) - 1) * np.exp(gamma * A * yr / xk * (tao1 - tao)))
print("tao >= tao2")
return e
In [50]:
tao = 9
print("tao1 = {} tao2 = {}".format(tao1, tao2))
rendimiento(tao)
Out[50]:
In [51]:
ttao = [i for i in range(5)]
ttao
Out[51]:
In [52]:
ttao = [i for i in np.linspace(0,5)]
ttao
Out[52]:
In [53]:
caso1 = [rendimiento(tao) for tao in np.linspace(0,15)]
caso1
Out[53]:
In [54]:
caso1
Out[54]:
In [80]:
Tao = np.linspace(0,15)
plt.plot(Tao, caso1)
plt.title("Modelo Lack")
plt.xlabel("$\tau$")
plt.ylabel("Rendimiento e")
#plt.legend(('$xk=0.3$'),loc=0)
Out[80]:
In [ ]:
$\tau$
In [ ]:
In [ ]:
In [ ]:
In [ ]: